package com.medical_houduan.controller;


import com.medical_houduan.commons.Result;
import com.medical_houduan.dto.DrugDto;
import com.medical_houduan.service.DrugService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/drug")
@Tag(name="药品模块",description = "药品模块")
public class DrugController {
    @Autowired
    DrugService drugService;
    //添加药品
    @PostMapping("/addDrug")
    @Operation(summary = "添加药品信息接口",description = "前端传入的参数封装到DTO实体上")
    public Result addDrug(@RequestBody DrugDto drugDto){

        Result result = drugService.addDrugService(drugDto);

        return result;
    }

    @GetMapping("/selectDrugById/{drugId}")
    @Operation(summary = "根据药品id查询药品信息接口",description = "根据传入的药品ID查询对应的药品信息")
    public Result selectDrugById(@PathVariable("drugId") Long drugId){

        Result result = drugService.selectDrugByID(drugId);
        return result;
    }

}
